EnvironmentManager
Manages the environment variables for the Computer! Also where you can hook the environment variables, so you can add your own functions to the addon api.
Fields
enviromentHooks
sm.scrapcomputers.enviromentManager.enviromentHooks = {}
Type: function[]
This variable contains functions, where you can hook the Computer API and be able to add, remove or modify the functions in the Computer API.
Example Code
-- A enviroment hook
---@param self ShapeClass
local function enviromentHook(self)
return {
-- Prints hello world
helloWorld = function()
print("Hello World!")
end,
-- This wont overwrite the sc table!
sc = {
-- Gets all of myComponent and returns it
getMyComponent = function ()
return sm.scrapcomputers.componentManager.getComponents("SeatControllers", self.interactable, true)
end
}
}
end
-- Add the hook to the enviroment Hooks
table.insert(sm.scrapcomputers.enviromentManager.enviromentHooks, enviromentHook)
Functions
sm.scrapcomputers.enviromentManager.createEnv( self )
Creates a environment variables table and returns it.
Arguments:
- self [ ShapeClass ] This should be the
self
keyword, aka your class.
Returns:
- [ ComputerAPI ] The created environment variables.